package com.slipper.bpmn.parser.support;

import com.slipper.bpmn.model.EndNode;
import com.slipper.bpmn.parser.IParser;
import org.dom4j.Element;

public class EndNodeParser implements IParser<EndNode> {
    @Override
    public EndNode parser(Element element) {
        EndNode endNode = parser(new EndNode(), element);
        if (endNode.getInLine().isEmpty()) {
            throw new RuntimeException("结束节点必须至少有一条流入线！");
        }
        if (!endNode.getOutLine().isEmpty()) {
            throw new RuntimeException("结束节点不允许有流出线！");
        }
        return endNode;
    }
}
